package service

import (
	"iot-base/common/notify"
	"strconv"
	"time"
)

func ReportDataFloat64(id string, data []string, mapField map[int]string) {
	now := time.Now().Unix()
	for k, v := range data {
		value, _ := strconv.ParseFloat(v, 64)
		if field, ok := mapField[k+1]; ok {
			notify.RawData(id, field, "", 0, value, now, now)
		}
	}
}

func ReportDataString(id string, data []string, mapField map[int]string) {
	now := time.Now().Unix()
	for k, v := range data {
		if field, ok := mapField[k+1]; ok {
			notify.RawData(id, field, "", 0, v, now, now)
		}
	}
}
